<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "tme_instockinfo".
 *
 * @property integer $id
 * @property string $billcode
 * @property integer $tau_id
 * @property string $operid
 * @property integer $tba_id
 * @property string $supplierid
 * @property integer $intype
 * @property string $intime
 * @property string $handler
 * @property double $totalmoney
 * @property string $remark
 *
 * @property TmeInstockdetailsinfo[] $tmeInstockdetailsinfos
 * @property TbaSupplierinfo $tba
 * @property TauOperinfo $tAu
 */
class TmeInstockinfo extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'tme_instockinfo';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['billcode', 'intime', 'handler'], 'required'],
            [['tau_id', 'tba_id', 'intype'], 'integer'],
            [['intime'], 'safe'],
            [['totalmoney'], 'number'],
            [['billcode', 'handler'], 'string', 'max' => 20],
            [['operid'], 'string', 'max' => 10],
            [['supplierid'], 'string', 'max' => 6],
            [['remark'], 'string', 'max' => 150]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'billcode' => 'Billcode',
            'tau_id' => 'Tau ID',
            'operid' => 'Operid',
            'tba_id' => 'Tba ID',
            'supplierid' => 'Supplierid',
            'intype' => 'Intype',
            'intime' => 'Intime',
            'handler' => 'Handler',
            'totalmoney' => 'Totalmoney',
            'remark' => 'Remark',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getTmeInstockdetailsinfos()
    {
        return $this->hasOne(TmeInstockdetailsinfo::className(), ['id' => 'id', 'billcode' => 'billcode']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getTba()
    {
        return $this->hasOne(TbaSupplierinfo::className(), ['ID' => 'tba_id', 'SupplierID' => 'supplierid']);
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getTAu()
    {
        return $this->hasOne(TauOperinfo::className(), ['ID' => 'tau_id', 'OperID' => 'operid']);
    }
}
